home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / dev / misc / gms_dev.lha / GMSDev / Source / Asm / Blitter / RandomPlot.s < prev    next >
Encoding:
Text File  |  1998-02-28  |  2.7 KB  |  114 lines

  1. ;-------T-------T------------------------T----------------------------------;
  2. ;This is a graphical demonstration of the Random() functions.  The default
  3. ;is to use FastRandom, but you can change it to SlowRandom if you look
  4. ;below.
  5. ;
  6. ;Note that there are no screen settings in this demo - all of the user
  7. ;defaults are used, including the palette colours.
  8. ;
  9. ;Press the LMB to exit.
  10.  
  11.     INCDIR    "GMSDev:Includes/"
  12.     INCLUDE    "dpkernel/dpkernel.i"
  13.  
  14. Random    =    _LVOFastRandom    ;_LVOFastRandom() or _LVOSlowRandom().
  15.  
  16.     SECTION    "Demo",CODE
  17.  
  18. ;===========================================================================;
  19. ;                             INITIALISE DEMO
  20. ;===========================================================================;
  21.  
  22.     STARTDPK
  23.  
  24. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  25.     move.l    DPKBase(pc),a6
  26.  
  27.     moveq    #ID_SCREEN,d0
  28.     CALL    Get
  29.     move.l    d0,Screen
  30.  
  31.     move.l    Screen(pc),a0
  32.     sub.l    a1,a1
  33.     CALL    Init
  34.     tst.l    d0
  35.     beq.s    .Exit
  36.  
  37.     moveq    #ID_JOYDATA,d0    ;Get joydata structure.
  38.     CALL    Get
  39.     move.l    d0,JoyData
  40.     beq.s    .Exit
  41.     move.l    d0,a0    ;Initialise the joydata structure.
  42.     sub.l    a1,a1
  43.     CALL    Init
  44.     tst.l    d0
  45.     beq.s    .Exit
  46.  
  47.     move.l    Screen(pc),a0
  48.     CALL    Show
  49.  
  50.     bsr.s    Main
  51.  
  52. .Exit    move.l    DPKBase(pc),a6
  53.     move.l    JoyData(pc),a0
  54.     CALL    Free
  55.     move.l    Screen(pc),a0
  56.     CALL    Free
  57.     MOVEM.L    (SP)+,A0-A6/D1-D7
  58.     moveq    #ERR_OK,d0
  59.     rts
  60.  
  61. ;===========================================================================;
  62. ;                                MAIN LOOP
  63. ;===========================================================================;
  64.  
  65. Main:
  66. .loop    move.l    DPKBase(pc),a6
  67.     move.l    JoyData(pc),a0
  68.     CALL    Query
  69.     move.l    JoyData(pc),a0
  70.     move.l    JD_Buttons(a0),d0
  71.     btst    #JB_LMB,d0
  72.     bne.s    .done
  73.  
  74.     move.l    Screen(pc),a0
  75.     move.l    GS_Bitmap(a0),a1
  76.     move.l    BMP_AmtColours(a1),d1    ;Get random colour.
  77.     subq.l    #1,d1
  78.     jsr    Random(a6)    ;>> = Get random number.
  79.     addq.l    #1,d0
  80.     move.l    d0,d3    ;d3 = Colour to use.
  81.  
  82.     move.w    GS_Width(a0),d1    ;Get random X.
  83.     jsr    Random(a6)    ;>> = Get random number.
  84.     move.w    d0,d4    ;d4 = Store X to use.
  85.  
  86.     move.w    GS_Height(a0),d1    ;Get random Y.
  87.     jsr    Random(a6)    ;>> = Get random number.
  88.     move.w    d0,d2    ;d2 = Y to use.
  89.     move.w    d4,d1    ;d1 = Get back X.
  90.  
  91.     move.l    BLTBase(pc),a6
  92.     move.l    Screen(pc),a0
  93.     move.l    GS_Bitmap(a0),a0
  94.     CALL    bltDrawUCPixel
  95.     bra.s    .loop
  96.  
  97. .done    rts
  98.  
  99. ;===========================================================================;
  100. ;                                  DATA
  101. ;===========================================================================;
  102.  
  103. JoyData:    dc.l  0
  104. Screen:        dc.l  0
  105.  
  106. ;===========================================================================;
  107.  
  108. ProgName:    dc.b  "Random Plot",0
  109. ProgAuthor:    dc.b  "Paul Manias",0
  110. ProgDate:    dc.b  "February 1998",0
  111. ProgCopyright:    dc.b  "DreamWorld Productions (c) 1996-1998.  Freely distributable.",0
  112. ProgShort:    dc.b  "Random pixel plotter.",0
  113.         even
  114.